/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rundata;

import java.io.File;
import java.io.IOException;
import java.sql.*;

/**
 *
 * @author Administrator
 */
public class Main {

    private static Connection connection;
    private static Statement statement;

    public static void main(String[] args) throws java.lang.Exception, ClassNotFoundException, IOException, InstantiationException, IllegalAccessException, SQLException {
        String url = "jdbc:mysql://" + "localhost" + ":3306/stockdabase";
        File searchdir = new File(System.getProperty("user.dir") + File.separator + "data");
        String[] list = searchdir.list();
        if (list != null) {
            for (String lis : list) {
                (new File(System.getProperty("user.dir") + File.separator + "data" + File.separator + lis)).delete();
            }
        }
        Object newInstance = Class.forName("com.mysql.jdbc.Driver").newInstance();
        try {
            connection = DriverManager.getConnection(url, "root", "38574638");
        } catch (SQLException ex) {
        }
        try {
            statement = connection.createStatement();
        } catch (SQLException ex) {
        }

        dataproce dp = new dataproce(connection);
       
        dp.ProcessAllData();
        
        connection.close();
    }
}
